__author__   = 'tommy'
__name__     = 'HTCHttp.py'
__license__  = 'htcharge.com@2016-08-29'
__version__  = 'v1.0.0'


import urllib2
import urllib
import json

def httpPost(aUrl, aParams):
  req  = urllib2.Request(url=aUrl, data=json.dumps(aParams))
  rsp = urllib2.urlopen(req)
  return rsp.read()
  

def httpGet(aUrl, aParams):
  tmpUrl = aUrl + "?" + aParams
  req = urllib2.Request(tmpUrl)
  rsp = urllib2.urlopen(req)
  return rsp.read()

def httpGet2(aUrl):
  req = urllib2.Request(aUrl)
  rsp = urllib2.urlopen(req)
  return rsp.read()